package com.matrix.draft.jvm.jmm;

import lombok.SneakyThrows;

/**
 * JIT高速缓存
 */
public class JITHighSpeedCache {

    public volatile static boolean flag = true;
    public static long count = 0;

    public static void main(String[] args) {
        new Thread(new Runnable() {
            @Override
            @SneakyThrows
            public void run() {
                while (flag) {
                    // 无内容
                }
            }
        }).start();

        new Thread(new Runnable() {
            @Override
            @SneakyThrows
            public void run() {
                Thread.sleep(1000); // 5秒后关闭flag
                flag = false;
            }
        }).start();
    }
}
